package com.jxl.charactersheet.controllers
{
	import com.jxl.charactersheet.models.Model;
	import com.jxl.dnd.Character;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	[Event(name="characterLoaded", type="com.jxl.charactersheet.controllers.Controller")]
	public class Controller extends EventDispatcher
	{
		public static const CHARACTER_LOADED:String = "characterLoaded";
		
		public function loadCharacterFromXML(xml:XML):void
		{
			var character:Character = new Character();
			character.buildFromXML(xml);
			Model.instance.currentCharacter = character;
			dispatchEvent(new Event("characterLoaded"));
		}
		
		
		
		private static var __inst:Controller;
		
		public static function get instance():Controller
		{
			if(__inst == null) __inst = new Controller();
			return __inst;
		}
	}
}